/**
 * @(#)DataLoader.java                  Oct 4, 2009 8:49:04 PM
 */
package com.radeonsys.litmus.data;

import org.springframework.core.io.Resource;

import com.radeonsys.litmus.data.schema.Schema;

import java.util.List;

/**
 * Represents a component that loads record data from a specified resource that can be utilized during tests
 *
 * @author Ranganath Kini (ranganathkini at gmail dot com)
 * @version 1.0
 */
public interface DataLoader<T extends Record> {
	
	/**
	 * Loads record data from the specified resource.  
     *
     * @param resource  a reference to a {@link Resource} representing the resource to load record data from
     *
     * @return  reference to an implementation of {@link List} containing implementations of {@link Record}
     *          that represent the record data that was loaded; an empty list if no record-data was loaded. The
     *          returned list must implement all rules of specified in {@see java.util.Collections#unmodifiableList(List)}
     *
     * @throws UnspecifiedSchemaException
     *          if this data loader implementation uses an {@link Schema} to perform the data loading which was
     *          unspecified.
	 */
	List<T> loadData(Resource resource);
	
	/**
     * Returns a reference to the schema that is to be used by this data loader implementation while loading data.
     *
     * <p>This is an optional method, if the data loader implementation does not support schema-based loading, then
     * this method may not be required.</p>
     *
	 * @return  reference to an implementation of {@link Schema} that is used by this data-loader to load the record
     *          data.
	 */
	Schema getSchema();
}
